ServiceNow Data Sources
You can add a ServiceNow data source to the KB, enabling data extraction from your ServiceNow knowledge base.
General Prerequisites
- You have a ServiceNow developer account. If you don't have one, create it here.
- You have already built a ServiceNow instance.
- Your developer account has permissions to register apps.
- You have a published DRUID bot.
Create OAuth client in ServiceNow
If you want to authenticate with OAuth when creating your ServiceNow data source, you need to create an OAuth client:
- Log into the ServiceNow developer portal.
- Click the Start building button.
- Your ServiceNow instance opens in a new browser window.
- In the All menu, search for 'Application registry' and click on it.
- The Application Registries page appears.
- Click the New button.
- Click on 'Create an OAuth API endpoint for external clients'.
- Enter a Name and in the Client secret field, enter a password.
- Copy the Client ID, you will need it in the DRUID Portal.
- Enter a password in the Client Secret field and save it securely. You will need this value later in the DRUID Portal.
- From the Client Type drop-down, select Integration as a Service.
- In the Auth Scopes table, double-click on Insert new row, enter useraccount and save the record.
- In the OAuth Application User field, enter the name of the user to which the OAuth app binds for client credential flow. Note that in this field you see only active users who haven been granted the roles rest_service or web_service_admin.
- Click the Submit button.
Adding ServiceNow data sources and extract data
This section explains how to add a ServiceNow data source and extract data from the ServiceNow Knowledge Base.
Step 1: Create the data source
- Click the Add New button. The Add New Data Source page opens.
- In the Name field, provide a name for the data source. This name helps you identify and search for the data source later.
- From the Language drop-down, select the language of the data you will upload. It must match one of the bot languages.
- From the Type drop-down, select ServiceNow. After you select the type, the content of the page displays additional fields required for adding a ServiceNow data source.
- Authenticate with ServiceNow. You can authenticate using Basic Authentication or OAuth:
- Basic Authentication:
- From the Authentication type field, select Basic.
- Enter the credentials (Username and Password) of a ServiceNow user with roles rest_service and web_service_admin.
- OAuth:
- In the URL field, provide the ServiceNow Instance Base URL.
- Log into the ServiceNow developer portal.
- Click on the Manage my instance button.
- Copy the Instance Base URL. Do not use the Copy icon, as it does not copy the full Base URL.
- The View endpoint field is prefilled with kb_view.do?sysparm_article={0}.
-
In the Discovery table field, the default value is kb_knowledge?workflow_state=published. This table is used by the KB Engine to crawl only published articles.
- In the Content table field, enter the name of the ServiceNow table from which the KB Engine will extract data.
- In the Discovery batch size field, change the number of items extracted per page if needed.
- In the Content JSON paths field, specify the JSON paths to extract content from the response when querying the content table. Example: result.text, result.kb_question, result.kb_answer.
- Optionally, set the Min score threshold and the Target match score for the data source. If not set, the thresholds from the Knowledge Base will apply.
- Click Create. The ServiceNow data source is now created and ready for crawling.
To get the Instance URL, follow these steps:
If left empty, content will be downloaded from the view endpoint for each article (only if the page is public).
If not specified, the entire content will be used.
Step 2. Crawl the data source
Click the Crawl button at the top-right corner of the data source page.
Wait until the crawling process finishes. This prepares the data for extraction.
Step 3. Extract the data
Click the Extract button at the top-right corner of the data source page.
Wait until the extraction process completes.
Step 4. Train the data source
To ensure the KB Engine can search through the data source articles, train your data source after extraction.